package com.hengpeng.itfin.persist.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.hengpeng.common.persist.AbstractDao;
import com.hengpeng.common.persist.query.DynamicQuery;
import com.hengpeng.common.persist.query.constants.QueryConstants.QueryType;
import com.hengpeng.itfin.persist.RewardDao;
import com.hengpeng.itfinbase.en.RewardType;
import com.hengpeng.itfinbase.persist.Reward;

@Repository
public class RewardDaoImpl extends AbstractDao<Reward> implements RewardDao {

    @Override
    public List<Reward> findRewardByTypes(RewardType[] rewardTypes) {
        DynamicQuery query = new DynamicQuery(Reward.class);
        if (rewardTypes != null && rewardTypes.length > 0) {
            query.inArray("rewardType", rewardTypes);
        }
        query.setQueryType(QueryType.JDBC);
        return super.findAllByDynamicQuery(query);
    }

}
